package 深入反射机制.可变参数长度.test01;

//可变长度参数
public class ArgsTest01 {
    public static void main(String[] args) {
        m();
        m(10);
        m(10,20);
        //m("abc");编译报错

        m2(99);
        m2(33,"普通上班族");

        m3("jojo","d","ds","pp","普通上班族","meade in haven");
    }

    public static void m(int...args){
        System.out.println("m方法执行了！！");
    }
    public static void m2(int i,String...args){
        System.out.println("m2方法执行了！！");
    }
    public static void m3(String...args){
        //有length属性，说明args是一个数组
        for (int i = 0; i < args.length; i++) {
            System.out.println(args[i]);
        }
    }
}
